#pragma once
#include "CRenderObj.h"

namespace Ware
{
	class IGraphic;
	class ITexture;
	class ISprite;
	class ISpriteAnimation;
}

class CAniRenderObj : public CRenderObj
{
	friend class CGameScene;
protected:
	CAniRenderObj( uint32 uID, ISceneManager* pSceneManager, IResourceManager* pResourceManager )
		: m_pSprite(NULL)
		, m_pAni(NULL)
		, m_pTexture(NULL)
		, CRenderObj( uID, pSceneManager, pResourceManager ) {}

	virtual VBOOL		Create();

public:

	virtual void		SetOffset( const CVector2& vOffset );
	virtual void		SetPos( int32 nX, int32 nY );
	virtual void		SetAlpha( VBOOL bAlphaBlend, int32 nAlpha );

	virtual void		SetWireFrame( VBOOL bWire );

	virtual VBOOL		Render( IGraphic* pGraphic, uint32 uCurTime );

	virtual void		GetBoundRect( SIntRect& rcBound );

	void				SetTexture( ITexture* pTexture );

	int32				GetWidth();
	int32				GetHeight();
	void				SetWidth( int32 nWidth );
	void				SetHeight( int32 nHeight );

	void				SetAction( const VCHAR* szActionName );
	void				SetAniSpeed( float32 fAniSpeed );

	ISpriteAnimation*	AttachAnimation( ISpriteAnimation* pAnimation );
	ISpriteAnimation*	AttachAnimation( const VCHAR* szAniFileName );
	ISpriteAnimation*	GetAnimation()	{ return m_pAni; }

private:

	ISprite*			m_pSprite;
	ITexture*			m_pTexture;
	ISpriteAnimation*	m_pAni;
};